#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os

def create_svg_placeholders():
    image_dir = "/Users/wangqi/Documents/code/privateorder/pan/halo/application/src/main/resources/themes/alibaba-b2b-theme/assets/images"
    
    print("🎨 创建SVG占位图片...")
    
    # 定义要创建的图片
    images_to_create = [
        ("hero-slide-1.jpg", 1920, 600, "产品展示 1"),
        ("hero-slide-2.jpg", 1920, 600, "产品展示 2"),
        ("hero-slide-3.jpg", 1920, 600, "产品展示 3"),
        ("logo.png", 200, 80, "LOGO"),
        ("company-overview.jpg", 800, 600, "公司概况"),
        ("product-1.jpg", 400, 300, "产品 1"),
        ("product-2.jpg", 400, 300, "产品 2"),
        ("product-3.jpg", 400, 300, "产品 3"),
        ("product-4.jpg", 400, 300, "产品 4"),
        ("product-5.jpg", 400, 300, "产品 5"),
        ("product-6.jpg", 400, 300, "产品 6"),
        ("product-7.jpg", 400, 300, "产品 7"),
        ("product-8.jpg", 400, 300, "产品 8"),
        ("news-1.jpg", 400, 300, "新闻 1"),
        ("news-2.jpg", 400, 300, "新闻 2"),
        ("news-3.jpg", 400, 300, "新闻 3"),
        ("wechat-qr.jpg", 200, 200, "微信二维码"),
        ("product-placeholder.jpg", 400, 300, "产品占位图"),
        ("news-placeholder.jpg", 400, 300, "新闻占位图"),
        ("product-detail-2.jpg", 800, 600, "产品详情 2"),
        ("product-detail-3.jpg", 800, 600, "产品详情 3"),
    ]
    
    for filename, width, height, text in images_to_create:
        file_path = os.path.join(image_dir, filename)
        
        # 创建SVG内容
        svg_content = f'''<svg width="{width}" height="{height}" xmlns="http://www.w3.org/2000/svg">
    <rect width="{width}" height="{height}" fill="#FF6A00"/>
    <text x="50%" y="50%" font-family="Arial, sans-serif" font-size="24" fill="white" text-anchor="middle" dominant-baseline="middle">{text}</text>
</svg>'''
        
        try:
            with open(file_path, 'w', encoding='utf-8') as f:
                f.write(svg_content)
            print(f"  ✅ 创建成功: {filename} ({width}x{height})")
        except Exception as e:
            print(f"  ❌ 创建失败: {filename} - {str(e)}")
    
    # 创建简单的favicon
    try:
        favicon_path = os.path.join(image_dir, "favicon.ico")
        favicon_content = '''<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg">
    <rect width="32" height="32" fill="#FF6A00"/>
    <text x="16" y="20" font-family="Arial, sans-serif" font-size="12" fill="white" text-anchor="middle">L</text>
</svg>'''
        with open(favicon_path, 'w', encoding='utf-8') as f:
            f.write(favicon_content)
        print(f"  ✅ 创建成功: favicon.ico (32x32)")
    except Exception as e:
        print(f"  ❌ 创建失败: favicon.ico - {str(e)}")
    
    print("\n🎉 所有SVG占位图片创建完成！")
    
    # 显示创建的文件信息
    print("\n📋 创建的文件信息:")
    for filename in sorted(os.listdir(image_dir)):
        if filename.endswith(('.jpg', '.png', '.gif', '.ico')):
            file_path = os.path.join(image_dir, filename)
            if os.path.isfile(file_path):
                file_size = os.path.getsize(file_path)
                print(f"  {filename}: {file_size} bytes")

if __name__ == "__main__":
    create_svg_placeholders()